﻿using App.Services;
namespace App.Middles
{
    //约定的中间件，无需手动添加到ioc
    public class GreetingV2Middleware
    {
        public GreetingV2Middleware(RequestDelegate next, IGreetingService service)
        {
            _service = service;
        }

        private readonly IGreetingService _service;

        public async Task InvokeAsync(HttpContext context)
        =>await context.Response.WriteAsync(_service.Greeting(DateTimeOffset.Now));
    }
}
